#include "adc_dianwei.h"
#include "main.h"
#include "adc.h"
#include "serial.h"

uint16_t adc_ret=0;
uint16_t total_adc_ret[10]={0};
uint8_t adc_i=0;
HAL_StatusTypeDef halstate;

uint16_t adc_dianwei_get_value(void)
{
	halstate= HAL_ADC_PollForConversion(&hadc1, 10);
	if(halstate == HAL_OK)
	{
		adc_ret = HAL_ADC_GetValue(&hadc1);
		total_adc_ret[adc_i]=adc_ret;
		if(adc_i<9)
			adc_i++;
		else
			adc_i=0;
		
	}
	
	return adc_ret;
}
